package com.f2prateek.rx.preferences2;

import io.reactivex.annotations.NonNull;
import ohos.data.preferences.Preferences;

final class IntegerAdapter implements RealPreference.Adapter<Integer> {
  static final IntegerAdapter INSTANCE = new IntegerAdapter();

  @NonNull
  @Override public Integer get(@NonNull String key, @NonNull Preferences preferences,
                               @NonNull Integer defaultValue) {
    return preferences.getInt(key, defaultValue);
  }

  @Override public void set(@NonNull String key, @NonNull Integer value,
      @NonNull Preferences editor) {
    editor.putInt(key, value);
  }
}
